package com.jiajia.study.nio.chapter03;


import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.StandardCharsets;

public class MyClient {
    public static void main(String[] args) throws IOException {
//        SocketChannel socketChannel = SocketChannel.open();
//        socketChannel.configureBlocking(false);
//
//        socketChannel.connect(new InetSocketAddress(8777));
//
//        socketChannel.write(StandardCharsets.UTF_8.encode("hellosuns\n"));
//        System.out.println("----------------------------------------------");
//        //
//
//        socketChannel.close();

        SocketChannel socketChannel = SocketChannel.open();
//        socketChannel.configureBlocking(false);
        socketChannel.connect(new InetSocketAddress(8777));

        socketChannel.write(StandardCharsets.UTF_8.encode("hellosuns\n"));

        socketChannel.close();
    }
}
